<script type="text/javascript">
/*****
    function validate()
    {
      if(document.getElementById('unameId').value=="") {
        alert('Name should not be blank :(.');
        document.getElementById('unameId').focus();
        return false;
      }
      if(document.register.uname.value.length < 6) {
        alert('Name should be 6 char long :(');
        document.getElementById('unameId').focus();
        document.getElementById('unameId').select();
        return false;
      }

      return true;
    }
*/
    function validate()
    {
      var oUname = document.getElementById('unameId');

      if(oUname.value=="") {
        alert('Name should not be blank :(...');
        oUname.focus();
        return false;
      }
      if(oUname.value.length < 6) {
        alert('Name should be 6 char long :(...');
        oUname.focus();
        oUname.select();
        return false;
      }

      return true;
    }

</script>

<form action="" name="register" onSubmit="return validate(this)" method="get">
  <input type="text" placeholder="My name is" name="uname" id="unameId" />
  <input type="password" placeholder="My password is"  name="password"   />
  <input type="submit" value="I am done!!" />
</form>
